package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.clqteam.dao.ShowEmployeeNameDao;
import com.clqteam.model.Employee;
import com.clqteam.model.Role;
import com.clqteam.util.JDBCutil;
/**
 * 
 * @author CLQ
 *
 */
public class ShowEmployeeNameDaoImpl implements ShowEmployeeNameDao{

	@Override
	public List<Employee> getEmployeeName() {
		
		List<Employee> employee=new ArrayList<Employee>();
		StringBuffer sql = new StringBuffer();
		sql.append(" SELECT  s_employee.eName,s_employee.eId FROM s_employee");
		Connection con=JDBCutil.getConnection();
		try {
			 PreparedStatement pst=con.prepareStatement(sql.toString());
			 ResultSet rs=pst.executeQuery();
			 while(rs.next()){
				 Employee emp=new Employee();
				 emp.seteName(rs.getString("eName"));
				 emp.seteId(rs.getInt("eId"));
				 employee.add(emp);
			 }
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return employee;
	}
   
}
